Title: Custom Field: Nickname v1.1

Author: John Briggs

Description:
This modification will provide an additional field.
The additional field can be entered on your member registration form.
The additonal field is editable in your member control panel and admin edit profile tool.
The additonal field is displayed in your member profile and threads.

Compatability: XMB 1.9.8 SP3/SP4

Install Note: Before adding this modification to your forum you should back up all files related to this modification.

License Note: This modification is released under the GPL License. A copy is provided with this software package.

Note: Backup all affected files, templates and database.

Affected Files (5): editprofile.php, member.php, memcp.php, viewthread.php, lang/English.lang.php

Affected Templates (5): admintool_editprofile, member_profile, member_reg, memcp_profile, viewthread_post

Author Note:
You downloaded this modification from XMB Garage.
Please visit http://www.xmbgarage.com/ for support.

Copyright:  2009 John Briggs. All rights reserved.

=======================================================================================================================================
=======
Step 1:
=======
==============================
Go To Admin Panel --> Insert Raw SQL
==============================
==========================
Paste Code Below & Click Submit:
==========================

ALTER TABLE `$table_members` ADD `nickname` varchar(100) NOT NULL default '';

=======================================================================================================================================
=======
Step 2:
=======
=================
Edit File: member.php
=================
==========
Find Code:
==========

loadtemplates(

================
Replace Code With:
================

loadtemplates(
'member_profile_nickname',

==========
Find Code:
==========

                $sig = postedVar('sig', 'javascript', ($SETTINGS['sightml']=='off'), TRUE, TRUE);

===============
Add Code Below:
===============

                // Custom Field: Nickname
                $nickname = postedVar('nickname', 'javascript', TRUE, TRUE, TRUE);
                // Custom Field: Nickname

=================
Find Code (2 Times):
=================

) VALUES ('$username'

=======================
Replace Code With (2 Times):
=======================

, nickname) VALUES ('', '$username',

=======================================
Find Code At End Of  Both Above Query Statements:
=======================================

)");

==================
Replace Code With:
==================

, '$nickname')");

==========
Find Code:
==========

                if (X_MEMBER && $memberinfo['email'] != '' && $memberinfo['showemail'] == 'yes') {
                    $email = $memberinfo['email'];
                } else {
                    $email = '';
                }

===============
Add Code Below:
===============

                // Custom Field: Nickname Mod Begin
                // create nickname block
                $nicknameblock = '';
                if ($memberinfo['nickname'] != '') {
                    $memberinfo['nickname'] = censor($memberinfo['nickname']);
                    eval('$nicknameblock = "'.template('member_profile_nickname').'";');
                }
                // Custom Field: Nickname Mod End

=======================================================================================================================================
=======
Step 3:
=======
=================
Edit File: memcp.php
=================
==========
Find Code:
==========

        $sig = isset($_POST['newsig']) ? checkInput($_POST['newsig'], '', $SETTINGS['sightml'], '', false) : '';

===============
Add Code Below:
===============

        // Custom Field: Nickname Mod Begin
        $newnickname = formVar('newnickname');
        $nickname = $newnickname ? checkInput($newnickname, 'no', 'yes', 'javascript', false) : '';
        // Custom Field: Nickname Mod End

==========
Find Code:
==========

        $sig = addslashes($sig);

===============
Add Code Below:
===============

        $nickname = addslashes($nickname);

==========
Find Code:
==========

 WHERE username='$xmbuser'");

==================
Replace Code With:
==================

, nickname='$nickname' WHERE username='$xmbuser'");

=======================================================================================================================================
=======
Step 4:
=======

==========================
Edit File: editprofile.php
==========================

==========
Find Code:
==========

    $sig = isset($_POST['newsig']) ? checkInput($_POST['newsig'], '', $SETTINGS['sightml'], '', false) : '';

===============
Add Code Below:
===============

    // Custom Field: Nickname Mod Begin
    $newnickname = formVar('newnickname');
    $nickname = $newnickname ? checkInput($newnickname, 'no', 'yes', 'javascript', false) : '';
    // Custom Field: Nickname Mod End

==========
Find Code:
==========

    $sig = addslashes($sig);

===============
Add Code Below:
===============

    // Custom Field: Nickname Mod Begin
    $nickname = addslashes($nickname);
    // Custom Field: Nickname Mod End

==========
Find Code:
==========

 WHERE username='$user'");

==================
Replace Code With:
==================

, nickname='$nickname' WHERE username='$user'");

=======================================================================================================================================
=======
Step 5:
=======
===================
Edit File: viewthread.php
===================
==========
Find Code:
==========

            if ($post['location'] != '') {
                $post['location'] = censor($post['location']);
                $location = '<br />'.$lang['textlocation'].' '.$post['location'];
            } else {
                $location = '';
            }

===============
Add Code Below:
===============

            // Custom Field: Nickname Mod Begin
            $nickname = '';
            if ($post['nickname'] != '') {
                $post['nickname'] = censor($post['nickname']);
                $nickname = '<br />'.$lang['nickname'].' '.$post['nickname'];
            }
            // Custom Field: Nickname Mod End

==========
Find Code:
==========

            $location = '';
            $mood = '';

===============
Add Code Below:
===============

            $nickname = '';

=======================================================================================================================================
=======
Step 6:
=======
=======================
Edit File: lang/English.lang.php
=======================
============================
Add Code To End Of File Above ?>
============================

// Custom Field: Nickname Mod Begin
$lang['nickname'] = "Nick Name:";
// Custom Field: Nickname Mod End

=======================================================================================================================================
=======
Step 7:
=======
==========================
Go To Admin Panel --> Templates
==========================
===========================
Edit Template: admintool_editprofile
===========================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textsite]</td>
<td bgcolor="$altbg2"><input type="text" name="newsite" size="25" value="$member[site]" /></td>
</tr>

===============
Add Code Above:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[nickname]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="newnickname" size="25" value="$member[nickname]" /></td>
</tr>

=======================================================================================================================================
=======
Step 8:
=======

==========================
Go To Admin Panel --> Templates
==========================
===========================
Edit Template: member_reg_optional
===========================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textsite]</td>
<td bgcolor="$altbg2"><input type="text" name="site" size="25" value="" /></td>
</tr>

===============
Add Code Above:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[nickname]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="nickname" size="25" value="" /></td>
</tr>

=======================================================================================================================================
=======
Step 9:
=======
==========================
Go To Admin Panel --> Templates
==========================
=======================
Edit Template: memcp_profile
=======================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textsite]</td>
<td bgcolor="$altbg2"><input type="text" name="newsite" size="25" value="$member[site]" /></td>
</tr>

===============
Add Code Above:
===============

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[nickname]</td>
<td bgcolor="$THEME[altbg2]"><input type="text" name="newnickname" size="25" value="$member[nickname]" /></td>
</tr>

=======================================================================================================================================
========
Step 10:
========
==========================
Go To Admin Panel --> Templates
==========================
========================
Edit Template: viewthread_post
========================
==========
Find Code:
==========

$lang[textposts] $post[postnum]

===============
Add Code Above:
===============

$nickname

=======================================================================================================================================
========
Step 11:
========
==========================
Go To Admin Panel --> Templates
==========================
=======================
Edit Template: member_profile
=======================
==========
Find Code:
==========

<tr class="tablerow">
<td bgcolor="$altbg1" width="22%">$lang[textsite]</td>
<td bgcolor="$altbg2"><a href="$site" target="_blank">$site</a></td>
</tr>

===============
Add Code Above:
===============

$nicknameblock

=======================================================================================================================================
========
Step 12:
========
==========================
Go To Admin Panel --> Templates
==========================
====================================
Create New Template: member_profile_nickname
====================================

===================
Add Code and Submit:
===================

<tr class="tablerow">
<td bgcolor="$THEME[altbg1]" width="22%">$lang[nickname]</td>
<td bgcolor="$THEME[altbg2]">$memberinfo[nickname]</td>
</tr>

=======================================================================================================================================
Enjoy!